/*
 * @Author: CodeHare
 * @Date: 2023-10-28 21:26:03
 * @LastEditors: CodeHare
 * @LastEditTime: 2023-12-11 18:03:44
 * @Description: EMS参数设置模块根页面
 */
import 'dart:io';

import 'package:get/get.dart';
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:yt_devops/styles/styles.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yt_devops/services/site/site_services.dart';
import 'package:yt_devops/pages/devices/device_tab/device_detail/ems/self_develop_ems_romote_control/ems_params_setting/ems_params_setting_controller.dart';

class EmsParamsSettingView extends GetView<EmsParamsSettingController> {
  EmsParamsSettingView({Key? key}) : super(key: key);

  final SiteServices siteServices = Get.find<SiteServices>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          controller.title,
          style: TextStyle(fontSize: 18.sp),
        ),
        leading: IconButton(
          icon: Icon(
              Platform.isAndroid ? Icons.arrow_back : Icons.arrow_back_ios,
              color: Colour.mainTextColor),
          onPressed: () => Get.back(),
        ),
      ),
      body: SafeArea(
        child: Column(
          children: [
            Container(
              padding: const EdgeInsets.fromLTRB(0, 0, 10, 0),
              color: Colour.white,
              child: BrnTabBar(
                controller: controller.tabController,
                labelStyle:
                    TextStyle(fontSize: 16.sp, fontWeight: FontWeight.bold),
                unselectedLabelStyle: TextStyle(fontSize: 16.sp),
                labelColor: Colour.primaryColor,
                unselectedLabelColor: Colour.black,
                indicatorPadding: EdgeInsets.symmetric(horizontal: 20.w),
                indicatorWeight: 3,
                tabs: tabs,
              ),
            ),
            Expanded(
              child: TabBarView(
                controller: controller.tabController,
                children: controller.tabsViews,
              ),
            )
          ],
        ),
      ),
    );
  }

  List<BadgeTab> get tabs {
    return controller.tabs.map((item) {
      return BadgeTab(
        text: item,
      );
    }).toList();
  }
}
